$(function() {
//观影方向类似的效果	
	$('.ttuorul').each(function(){
		var $this=$(this);
		$this.find(".ttuor").eq(0).find(".res_watch").show();
		$this.find(".ttuor").eq(0).find(".res_xs").hide();
		$this.find(".ttuor").bind("mouseover", function() {
			$this.find(".ttuor .res_watch").hide();
			$this.find(".ttuor .res_xs").show();
			$(this).find(".res_watch").show();
			$(this).find(".res_xs").hide();
		})
	})
	


});
(function($) {
function ShowImages() {}
	ShowImages.target = ".show-images";
	ShowImages.$target = $(ShowImages.target);
	ShowImages.$list = ShowImages.$target.find(".con");
	ShowImages.$items = ShowImages.$target.find("ul");
	ShowImages.$btn = ShowImages.$target.find(".changing-over");
	
	ShowImages.now = 0;  //起始索引.
	ShowImages.num = 1;  //展示数量.
	ShowImages.itemWidth = ShowImages.$items.width();  //项目宽度.
	ShowImages.itemlength = ShowImages.$items.length;  //项目长度.
	ShowImages.maxScroll = ShowImages.itemlength - ShowImages.num;  //最大滚动.
	
	/**
	 * 初始化程序.
	 * @return {Object} this.
	 */
	ShowImages.init = function() {
		if($(".con ul").length<2) {
				$(".right").hide();
				$(".left").hide();
				
		}
		ShowImages.$btn.on("click", function() {
			
			var _$parent = $(this).parent(),
				_now = _$parent.data("now") || ShowImages.now,
				_itemWidth = ShowImages.itemWidth,
				_maxScroll = _$parent.data("maxScroll", _$parent.find("ul").length - ShowImages.num ).data("maxScroll");
			
			if( ShowImages.$list.filter(":animated").length ) {  //在进行动画时屏蔽单击操作.
				return ;
			}
			
			
			if($(this).hasClass("left")){
				$(".right").removeClass("gray");
				if(_now<=1){
					_now=0;
					$(".left").addClass("gray");
				}
				else{
					_now--;

				}
			}
			else{
				$(".left").removeClass("gray");
				if(_now>=_maxScroll-1){
					_now=_maxScroll;
					$(".right").addClass("gray");
				}
				else{
					_now++;

				}
			}
			_$parent.data("now",_now);
			
			_$parent.find(".con").animate({"margin-left": -_now * _itemWidth}, "fast");
			
		});
		
		// return ShowImages.$target.map(function() {
		// 	$(this).find("ul").length > ShowImages.num
		// 		&& $(this).find(".changing-over.right").show();
		// });
	}
	
	ShowImages.init();

	/*自适应屏幕宽度*/
	function winResize() {
		var winWidth = $(window).width();
		if (winWidth < 1200) {
			$("body").addClass("w980");
		} else {
			$("body").removeClass();
		}
		sWidth = $(".pichow").width();
		$(".pichow ul").css("width", sWidth * (len));
		showPics(i_bnr);

		ShowImages.$list.css("margin-left", "0");
		ShowImages.itemWidth = ShowImages.$items.width();
		ShowImages.init();
	};

	/*调用*/
	winResize();
	$(window).resize(function() {
		winResize();
	});
})(jQuery);

//选项卡 -  n变量    
function setTab1(name, cursel, n) {
	for (i = 1; i <= n; i++) {
		var menu = document.getElementById(name + i);
		var con = document.getElementById("j_" + name + "_" + i);
		menu.className = i == cursel ? "hover" : "";
		con.style.display = i == cursel ? "block" : "none";
	}
}
function hideTab(name,i,obj){
	obj.removeClass("hover");
	$("#j_" + name + "_" + i).hide();
}










